
#include <stdio.h>
/*
    shell_sort 
    首先对d的增量序列进行插入排序
    ·
    ·
    ·
    最后 d=1 
*/
void insert_sort(int a[], int n)
{
    //d增量序列
    for (int d = 5; d >= 1; d -= 2)
    {
        /*插入排序*/
        int i;
        for (int p = d; p < n; p += d)
        {
            int temp = a[p];
            for (i = p - d; i >= 0 && a[i] > temp; i -= d)
                a[i + d] = a[i];
            a[i + d] = temp;
        }
        /**/
    }
}

void main()
{
    int a[] = {4, 3, 8, 2, 7, 11, 6, 1, 0, 15};
    insert_sort(a, 10);
    for (int i = 0; i < 10; i++)
        printf("%3d", a[i]);
}